package com.xcity.game.equip.template;

import com.xcity.game.equip.EquipQuality;

import naga.x.game.template.Template;
import naga.x.game.template.TemplateException;
import naga.x.game.template.annotation.Excel;
import naga.x.util.CommonUtils;

/**
 * 装备产出（属性数量）
 * @author yang.li
 *
 */
@Excel(value = "equip.xlsx", sheet = 4)
public class EquipAttrNumWeightTemplate extends Template {

	/** 装备品质（0=D，1=C，2=B，3=A，4=AA，5=AAA，6=S） */
	protected EquipQuality quality;

	/** 属性槽最小数量 */
	protected int min;

	/** 最小数量权重 */
	protected int minWeight;

	/** 属性槽最大数量 */
	protected int max;

	/** 最大数量权重 */
	protected int maxWeight;

	public EquipQuality getQuality() {
		return quality;
	}

	public void setQuality(EquipQuality quality) {
		this.quality = quality;
	}

	public int getMin() {
		return min;
	}

	public void setMin(int min) {
		this.min = min;
	}

	public int getMinWeight() {
		return minWeight;
	}

	public void setMinWeight(int minWeight) {
		this.minWeight = minWeight;
	}

	public int getMax() {
		return max;
	}

	public void setMax(int max) {
		this.max = max;
	}

	public int getMaxWeight() {
		return maxWeight;
	}

	public void setMaxWeight(int maxWeight) {
		this.maxWeight = maxWeight;
	}
	
	/**
	 * 确定属性数量
	 * @return
	 */
	public int getNum() {
		int n = CommonUtils.randomInt(minWeight + maxWeight);
		return n < minWeight ? min : max;
	}


	@Override
	public void validate() throws TemplateException {}
}
